package com.itheima.Set.MySetDemo;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class mysetdemo {
    public static void main(String[] args) {
        Set<String> set=new TreeSet<>();
        set.add("ccc");


        set.add("bbb");
        set.add("bbb");

        set.add("aaa");
        //Iterator迭代器循环
        Iterator<String>it=set.iterator();
        while (it.hasNext()){
            String s = it.next();
            System.out.println(s);
        }
        System.out.println("---+_+_+---");

        for (String s : set) {
            System.out.println(s);
        }
    }
}
